package com.iweb.goods.service;

import com.iweb.goods.dao.GoodsDao;
import com.iweb.goods.dao.GoodsDaoImpl;
import com.iweb.goods.model.Goods;
import com.iweb.util.PageModel;

import java.util.List;

public class GoodsServiceImpl implements GoodsService{
    GoodsDao goodsDao=new GoodsDaoImpl();
    @Override
    public boolean isContainGoodsName(String goodsName) {
        return goodsDao.findByGoodsName(goodsName)==0;
    }

    @Override
    public List<Goods> selectByPage(PageModel pageModel) {
        return goodsDao.selectByPage(pageModel);
    }

    @Override
    public List<Goods> selectByMyPage(PageModel pageModel,Integer userid) {
        return goodsDao.selectByMyPage(pageModel,userid);
    }

    @Override
    public Goods selectById(Integer goodsid) {
        return goodsDao.selectById(goodsid);
    }

    @Override
    public int saveOne(Goods goods) {
        return goodsDao.saveOne(goods);
    }

    @Override
    public int updateOne(Goods goods) {
        return goodsDao.updateOne(goods);
    }

    @Override
    public int deleteOne(Integer goodsid) {
        return goodsDao.deleteOne(goodsid);
    }
}
